Subsurface control apparatus for use in oil and gas wells

ABSTRACT

A magnetic pipe joint detector and digital logic circuits electrically coupled thereto are located in a fluidtight housing which is lowered through a string of pipe in an oil or gas well by means of a wire line. Coupled to the housing for lowering therewith is a downhole device which requires operation after it is lowered into the well. After the device reaches approximately the desired depth in the well, the housing is raised past a predetermined number of pipe joints. The logic circuits detect this occurrence and activate a timer which, after a predetermined time interval, initiates the operation of the downhole device.

l 6 6 6 b a X R 3 a 5 7 Q 9 5 9 4' United States Patent r 13,570,594

[72] Inventor Howell M. Hamilton 3,105,547 /1963 Ownby 166/65 c/o Bell Engineering P.O. Box 3347, 3,105,548 10/1963 Ownby 166/63X Odessa, Tex. 79760 3,114,876 12/1963 Schuster 166/66X [21] App1.No. 806,891 3,264,994 8/1966 Leutwyler 166/63X [22] Filed Mar. 13, 1969 3,396,788 8/1968 Bell 166/66X Patented 1971 Primary Examiner-David H. Brown Attorney-Pravel, Wilson & Matthews [54] SUBSURFACE CONTROL APPARATUS FOR USE IN OIL AND GAS WELLS u Chums 5 Drawing Flgs' ABSTRACT: A magnetic pipe joint detector and digital logic [52] US. Cl 166/64, i i electrically coupled thereto are located in a fl idti ht 166/66 housing which is lowered through a string of pipe in an oil or [51] Int. Cl ..E2lb 23/00, gas well by means f a wire line. Coupled to the housing for B219 47/ 1 2 lowering therewith is a downhole device which requires opera- [50] Field of Search 166/64, 63, hon after it is lowered the we Aft the device reaches 65,65 66; 324/(Inquired) approximately the desired depth in the well, thehousing is raised past a predetermined number of pipe joints. The logic 1 References Cited circuits detect this occurrence and activate a timer which, UNITE STATES PATENTS after a predetermined time interval, initiates the operation of 2,776,564 1] l 7 Montgomery et al l66/64X the downhole device.

.face of the earth. f It is another object of the invention to provide new andirn- "proved subsurface contrel apparatus which provides an improved degree of safety Referring to the drawings: 1

'tained in the control apparatus of FIG. 1; and

. ln order to set a packe orfire a shot lowered into a well-bjy means of a line, it has heretofore been the practice to ploy a wire line. or cable having locatedwithinthe interior thereof an insulated electrical conductor. After'the pack or shot is, lowered to the desireddepth, an electric currerjit issent down the insulated conductor to the age; or shot for setting or firing sameQWhile this method usually accomplishes desired purpose, there is, nevertheless, room for improvenient. For one thing, this method requires the u'se of a relatively expensive form of wire line or cable. For another thing, subject to the accidental actuationof the electric things at the surface of the earth before the downhole devicereaches the desired depth in the well.: For a further thing,,if thecable conductor should become brokenor shorted out at some between the surface and the downhole device, then it becomes impossible to operat'e the downhole device 5 S MMARY m: tNveN IoN and improved self-contained wireline control unit adaptedito any electrical connection 'with equipment locatedat the-sur- Idownhole devices.

thereto and lowering therewith a downhole :device which requires operation after it is lowered into the well. The control apparatus also iiic ludes magnetic detector means located in Qthe housingmeans for generatinghn electricai signaleach Utimethe detector means rho'ves'past a pipe joint. The'contiol .apparatus further includes electronic logic circuit .glocated in the housing means and responsive to the signals produced-by t, e magneti'c detector means for'producin'g'a -:control signal for initiating the operation of the downhele device. I For a better understanding ofthe present inventien, together with other and further objects andifea turesthe reference is had to the following description taken in con ection with the a'ccornpanying drawings, the'scope of the in I tion being pointed out in'the appendedclaims."

am ss oascmrrioNo HEDRAWINGS FIG. 1 shows the combination of a control, apparatus and a 'downhole device'suspended in a subsurface sectionofan oil or gas well, a magneticpipe joint detector portion of the control I apparatus being shown in a cross-sectional manner;

FIG. 3 is"?! block diagram of electronic logic circuits con- FIG. 4 is 'a'graph of the input-output signal transfer characteristic of a Schmitt trigger circuit used in the logic circuits of e i It is an object ofthe'invention, therefore, topr'ovide a new permanent magnets..l9 and 20 for producing, magnetic fluii.

DESCRIP'IXON OF THE PREFERRED EMBODIMENT 4 Referring to FIG. 1, therejis shown a 'combination of a'p (not shown) located at the surface of the earth. Wire line- 12' does not include any electrical conductors. It is a steel wire or cable used purely for mechanical hoisting purposes. f

The subsurface'section of oil or gas well shown in FIG. 1 includes a l irzoreholeeffiv drilled through'a' subsurface earth formation 14. Asst ring of casing pipe 15 'is located in the adrenals 13. Such casing stringl5 is made up of aseries of lengths sections of easing pipe connected togetherin aniend-to-end manner by means of casing collars. These pipe sections are typically on the order of 30 feet in length. flypical pipe tions are indicatediatllS a 1512, a typical easing'collarbeing indicated at 15c. Theannulus'between thefs'tring of casiiifi pipe 15 and the wall of the'borehole I3 is fill'edwith cement" I The subsurface control apparatus. or control unit 10 ine cludes a flujidtight housing 17 which isadapted'to be lowered through the string of pipe 15, by the wire line" 12." This housing 17 is mechanically connected to the lower end of the: wire line '12. Located insideof the housing' 17 a magnetic'pipejoint detector 18. This magnetic detector 18 produces an electrical signal each time it moves'past the jointbetween two sections of easing pipe. The particular form of detector 18 which is'il- 'lustrated in FIG. 1 is of a type commonlyrefe'rred to as a ing collar locator. As'such, it' can be though't of as detecting the presence of a casingcollar, such as the casingcollar 15c. The magnetic detector or collar locator 18 includes a pair of The collar locator .l8;also includes a seriesof pole. pieces .21,- 22,'23 and 24 located at the ends of the permanent magnets 19 and 20 for enabling themagnetic flux to link or jeouple with the wellpipe 15.-The' collar locator 1 8furtherinclude's a coil win'diirg'25 woundo'n acore member 26 located intermediate the permanent magnets 19 and 20 and extending between the pole pieces 22 and 23 Pole pieces 21, 22, 23 and 24 and the coremember 26 'are formed of a ferromagnetic material such as iron. The-portion of the housing 17 in the vicinity of the colilar locator 18 is'fo'rrned of a nonmagnetic material such as an locator moves past a'r'nagnetic anomaly,such as the casing collar 15c, thebalance of the magnetic circuits is disturbed and magnetic jflui'is' caused to pass through the coil 25 This change in magneticfliix'iniluces an electrical signal in'the coil 25," such signalthus denoting the passage of a casing collar.

. i The subsurface'controlapparatus l0 further'includes electroniclogic cireuits located inside'of a lower section 27 of the housinglj. Theselogic circuits are electrically connected to the collar'locator coil 25 by 'means of lead wires 28. Aswill be .seen in connectioriwithFlG. 2, these logic circuits include a switch mechanism for enabling the i'nitialtuming on and start- 'ing of such logic circuits. This switch mechanism is controlled from the exterior of the housing 17 by means of a control shaft 29 having an exposed slotted head which may be manipulated by means of a screwdriver oi the like.

The downhole device 11 illustrated in HQ. 1 takesthe form of a packer mechanism having an expandable packere'leineiit 30which, wheneirpanded, engages the inner wall of the casing pipe 15 for purposes of providinga partition across theinteri= or of the casing" pipe {5 for'iso'lating' a'lower portionjof' the pipe from the portionlof pipe 'ther eabove. The r device it also inclndes a: setting" tool .31 mechanic pled end of the control apparatus 10. This setting tool 31 responds to an electric current supplied thereto by the logic circuits contained in the lower housing section 27 and thereupon operates to drive the setting or packer expanding mechanism contained in the packer device 1 l.

It should be noted that the showing of a packer device is purely for sake .of an example. The control apparatus can, in fact, be used for initiating or controlling the operation of various other types of devices which require operation after they are lowered to a desired depth in an oil or gas well.

Referring to FIGS. 2A and 2B, there are shown waveform diagrams of difierent signals induced in the coil 25 of the collar locator 18. FIG. 2A shows the case where the collar locator 18 is moving past the casing collars in adownward direction. The collar locator signal indicated at 32 is produced as the collar locator 18 moves past a first casing collar and a subsequent signal indicated at 33 is produced as the collar locator 18 moves past the next casing collar. Considering the signal 32 in detail, it includes a positive fluctuation 34 followed by a negative fluctuation 35. Assuming that the signal 32 is produced by the casing collar 150, then the positive fluctuation 34 is produced as the pole piece 23 moves past the casing collar c, while the negative fluctuation 35 is produced as the pole piece 22 moves past the collar 15c.

FIG. 2B shows typical collar locator signals produced when the collar locator 18 is moving in an upwardly direction through the casing pipe 15. The signals for two different collars are indicated at 36 and 37. As'indicated by the signal 36, the upward movement produced collar locator signals include a negative-going fluctuation 38 followed by a positive-going fluctuation 39. This order of occurrence of the negative and positive fluctuations is just the reverse of the downward movement case depicted in FIG. 2A. As will be seen, this difference enables the logic circuits to determine whether the control apparatus 10 is moving in a downward or upward direction.

Referring now to FIG. 3, there is shown the electronic logic circuits located in the lower portion 27 of the housing 17. The lead wires 28 from the collar locator coil 25 are connected to input terminals 40 of the FIG. 3 circuits. These input terminals 40 are coupled by way of an amplifier circuit 41 to a form of bistable circuit represented by a Schmitt trigger circuit 42. The input-output signal characteristic of the Schmitt trigger circuit 42 is indicated in FIG. 4 by curve 43, input voltage values being plotted along the horizontal axis and output voltage values being plotted along the vertical axis of the FIG. 4 graph. Curve 43 includes a low output level portion 44, a high output level portion 45 and an unstable transition portion 46 located therebetween..

As the input voltage to Schmitt trigger 42 rises from a zero value, the output voltage will remain at the lower level 44 until the input voltage reaches a value of V When the input voltage exceeds V,, the Schmitt trigger circuit 42 will make an abrupt transition to the higher level 45 by way of transition portion 46. Similarly, if the input voltage is initially greater than V,, then as it decreases the output voltage will remain at the upper level 45 until the input voltage falls below the voltage level V,. At this point, the Schmitt trigger circuit 42 makes an abrupt transition to the lower level 44. From this it is seen that the Schmitt trigger circuit 42 exhibits hysteresis. In other words, to effect a transition in one direction, the input voltage must first pass beyond the voltage level at which the reverse transition took place.

The Schmitt trigger circuit 42 is biased so that when the signal level at the input terminals 40 is zero, the circuit 42 is operating at the input voltage level V in the FIG. 4 graph, this being a level approximately midway in the hysteresis region of the input-output characteristic 43. The amplified positive and negative fluctuations in the collar locator signals, as they appear at the input of the Schmitt trigger 42, serve to add to or subtract from this V bias level. These fluctuations are of sufficient amplitude such that a positive fluctuation will increase the input voltage to a point above the V trip level and a negative fluctuation will decrease the input voltage to a point below the V trip level. As a consequence, if the last occurring fluctuation of a given collar locator signal is a positive fluctuation, the output voltage of the Schmitt trigger circuit 42 will remain at the upper level 45 following the conclusion of the collar locator signal. Conversely, if the last occurring fluctuation is a negative one, then the output voltage of the Schmitt trigger 42 remains at the lower level 44 following the conclusion of the collar locator signal.

Since the remainder of the circuits in FIG. 3 are of the binary type, it is desired that the high level output of the Schmitt trigger 42 correspond to the binary one level of the system and that the low level output correspond to the binary zero level of the system. This can be accomplished by proper selection of the circuit parameters in the Schmitt trigger 42, or, in the alternative, a level adjusting buffer circuit can be connected to the output of the Schmitt trigger circuit 42 for accomplishing this result. For sake of simplicity, the former shall be assumed tobethecase. I v

The FIG. 3 logic circuits further include counting circuit means for counting the collar locator signals produced during downward and upward movements of the collar locator 18. In the present embodiment, this counting circuit means takes the form of a four-stage binary up-down counter 48. Counter 48 is provided with a pair of output lines for each of the four stages, one line of each pair being connected to one side of its stage and the other being connected to the complement side of the stage. Output li es A andA (not A) are for the first stage, output lines B and B are for the second stage, and so forth.

Counter 48 is a reversible counter which can count in either an upward direction or a downward direction, depending on the levels of the signals on direction control lines 49 and 50. The up line 49 is connected directly to the output of the Schmitt trigger 42, while the down line 50 is coupled to the output of Schmitt trigger 42 by way of a NOT circuit 51. NOT circuit 51 produces a binary zero level output when its input is at a binary one level and vice versa. Counter 48 counts in an upward direction when the up line 49 is at a binary one level and the down line 50 is at a binary zero level. Conversely, counter 48 counts in a downward direction when line 50 is at the one level and line 49 is at the zero level. Relative to the collar locator 18, counter 48 counts up when the collar locator is moving up and counts down when the collar locator is moving down.

The logic circuits of FIG. 3 further include pulse generator circuit means coupled to the bistable circuit represented by the Schmitt trigger 42 for generating a delayed pulse a predetermined time interval after each change of state of a particular polarity in such bistable circuit. This pulse generator circuit means includes a single-shot or monostable multivibrator circuit 52 which is coupled to the output of the Schmitt trigger 42 and which produces a narrow negativegoing output pulse each time the output of the Schmitt trigger 42 makes a positive-going (zero-toone) transition. Each pulse from single-shot circuit 52 shifts a flip-flop circuit 53 to its set condition. This produces a binary zero level at the output which, in turn, activates a charging circuit 54; This enables a capacitor in the charging circuit 54 to be charged up at a predetermined rate. This capacitor is connected to the input of a level-sensitive unijunction trigger circuit 55. The unijunction transistor in the unijunction circuit 55 tires when the capacitor charge reaches a predetermined level. Such firing produces a narrow negative-going output pulse which is supplied to the reset terminal of the flip-flop circuit 53. This resets flip-flop 53. This causes the Q output to return to the one level which, in turn, disables the charging circuit 54 and discharges the capacitor therein.

The negative-going pulse at the output of the unijunction circuit 55 is inverted by a NOT circuit 56 and then supplied to first inputs of a pair of AND circuits 57 and 58. The outputs of these AND circuits 57 and 58 are coupled by way of a common OR circuit 59 to the pulse counting input of the up-down counter 48. As a consequence, if the other two inputs to either one of the AND circuits 57 and 58 are at the one level, then the inverted or positive-going unijunction pulse is supplied to the counting input of the counter 48. When so supplied, such pulse either increases or decreases the count in the counter 48 by one count, depending on the status of the direction control signals on lines 9 and 50.

With one exception, each collar locator signal supplied to the input terminals 40 causes the Schmitt trigger .42 to undergo a positive-going, either alone or preceded or followed by a negative-going transition. Each such positive-going zeroto-one transition serves to trigger the single-shot circuit 52. A predetermined time interval afier each'triggering of the singleshot circuit 52, the unijunction circuit 55 produces the output pulse which, if other conditions are favorable (other inputs of AND circuits '57 and 58 at one level), is counted by the updown counter 48. This predetermined time interval or time delay is determined by the time constant in the capacitor charging circuit in the charging circuit 54. This time delay is provided in order to enable the signal levels on direction control lines 49 and 50 to assume their final steady values before the pulse to be counted is supplied to the counting input of the counter 48. This time delay will normally be on the order of one to four seconds and is selected to accommodate the slowest rate of movement of the collar locator 18 past a collar which is likely to be encountered. In other words, this time delay should be sufficient to allow movement of the collar locator 18 past a casing collar before the pulse to be counted is supplied to the input of the up-down counter 48.

The one exception where a collar locator signal does not cause a triggering of the single-shot circuit 52 is the case where the movement of the collar locator 18 has just changed from upward movement to downward movement. In this case, the first collar which is passed in the downward direction produces only a negative-going transition and the single-shot 52 is not triggered. Thus, one count is lost when the collar locator movement changes from up to down.

Note that a second input of the AND circuit 57 is connected to the output of the Schmitt trigger 42, while a second input of the AND circuit 58 is connected to' the output of the NOT circuit 51. As a consequence,following the occurrence of an upward movement produced collar locator signal, the second input of AND circuit 57 will be at the one level, while the second input of AND circuit 58 will be at the zero level. As a result, if conditions are otherwise favorable, the delayed pulse produced by unijunction circuit 55 will be supplied to the counter 48 by way of the up gate" AND circuit 57. Conversely, following the occurrence of a downward movement produced collar locator signal, the delayed pulse will be supplied by way of down gate AND circuit 58 to the counter 48.

The logic circuits of FIG. 3 also include circuit means coupled to the counting circuit means represented by the updown counter 48 and responsive to the downward and upward Considering first the detector circuit means 60, such circuit means includes a NAND circuit 62 for recognizing when the up-down counter 48 contains a bi nary count of 0000. When this condition occurs, the A, B, C and D output lines of the counter 48 are all at the binary one level and, hence, the out put of the NAND circuit 62 goes to the zero level. For any other count condition, the output of the NAND circuit 62 is at the binary one level; For present purposes, the 0000 condition should be thought of as the lower limit (LL) condition. The presence of a one level signal at the output of NAND circuit 62 indicates that the counter 48 is not at the lower limit condi tion. Among other things, this one level signal is supplied to the down gate AND circuit 58 for enabling such circuit to be activated when the other two inputs are at one level. The negative-going one-to-zero transition produced at the output of the NAND circuit 62 at the moment it reaches the lower limit condition is supplied to a flip-flop circuit 63 for shifting such circuit to its set condition. This causes the Q output of flipflop 63 to go to the one level, which one level signal is sup} plied to a first input of a NAND circuit 64. This tells the NAND circuit 64 that the counter 48 has been to the lower limit.

Thereafter, NAND circuit 64 operates to detect the occurrence of upward movement of the control apparatus 10 past a" minimum of three casing-collars. Following the counting of the second upwardmove ment produced collar locator signal, the B output line of the second stage of the up down counter 48 goes to the one level. This one level signal is supplied to a second input of the NAND gate 64. As a'consequence, if the control apparatus 10 is still moving in an upwardly direction when the delayed for the third casing collar is produced by the unijunction circuit 55, then this pulse will be passed by the NAND circuit 64 to a further flip-flop circuit 65. The inverting action of the NAN D circuit 64 causes the output pulse therefrom to be of negative-going polarity and such pulse serves to shift the flip-flop circuit 65 to its set condition. This causes the Q output line 66of the flip-flop 65 to go to .the one level. This one level signal on the line 66 constitutes the timer activating signal which activates the timer circuits 61.

A further NAND circuit 68 is coupled to appropriate ones of the output lines of the up down counter 48 for detecting the occurrence of a binary 0001 condition (a decimal count of eight) in the counter 48. This condition should be though of as being the upper limit (UL) condition and,- when it occurs, the output of NAND circuit 68 goes to a zero level. Otherwise, the output of NAND circuit 68 is at the one level (not upper limit level). The not upper limit one level signal is supplied back to the up gate AND circuit 57 for enabling such circuit to be activated when the control apparatus 10 is moving in the upwardly direction and the counter 48 is not at the upper limit. if the control apparatus 10 should be moved upwardly past a net total of eight casing collars, then the resulting negative-going one-to-zero transition at the output of the NAND circuit 68 is supplied by way of an AND circuit 6 9to the flip-flop 63 for shifting same to its reset condition. This disables the NAND circuit 64. The P input of AND circuit 69 is normally at the one level.

This negative-going transition at the output of NAND circuit 68 is also supplied by way of NOT circuit 70, NOR circuit 71 and AND circuit 72 to the flip-flop circuit 65 for purposes of shifting the flip-flop circuit 65 to its reset condition. The logic is such that if a one-to-zero transition occurs at the input of the NOT circuit 70, then a one-to-zero transition is produced at the output of the AND circuit 72. The P input of AND circuit 72 is normally at the one level. The resetting of the flip-flop circuit 65 returns the output line 66 to the zero level. This does two things; It resets the timer circuits 61 and it thereafter keeps these timer circuits 61 disabled until such time as another one level signal may appear on the output line 66.

If, after the control apparatus 10 has been moved upwardly past at least three casing collars and not more than seven casing collars, the control apparatus 10 is thereafter moved downwardly one or more casing collars pastthe first casing collar detected during theupward movement, then the timer circuits 61 are disabled. This happens because the tip-down counter 48 returns to the 0000 condition when the collar loca-' tor 18 passes the next collar below the first collar counted during the upward movement, it being remembered vthat one count is lost when the collar locator 18 changes from upward to downward movement. The resulting one-to-zero transitipii at the output of NAND circuit 62 is supplied by way of NOT circuit 73, AND circuit 74, NOR circuit 71 and AND circuit 72 to the flip-flop circuit 65 for shifting same to its reset condition. The logic is such that a negative-going one-to-zero transition at the input of the NOT circuit 73 produces a negativegoing one-to-zero transition at the output of the AND circuit 72.

The timer circuit means 61 of FIG. 3 includes a pulse generator 75 which produces pulses at a constant rate and supplies same to the pulse counting input of a seven-stage binary pulse counter 76. lnitially, the counter 76 has a zero setting. This zero setting is maintained until the one level activating signal appears on the output line 66 of the flip-flop circuit 65. Thereupon, counter 76 begins counting the pulses from the generator 75. Coupled to selected stages of the counter 76 is a multiple input AND circuit 77. After the counter 76 has counted a selected number of pulses, then AND circuit 77 produces a one level output signal which is supplied by way of a switch 78 to the ungrounded one of output terminals 79 for the control apparatus 10. These output terminals 79 are connected to lead wires which run to the setting tool portion 31 of the packer device 11. This one level output signal at the output of AND circuit 77 is the control signal which initiates the setting operation of the packer device 11.

By way of example, the pulse generator 75 may be constructed to produce pulses at the rate of 6 pulses per minute. Being a seven-stage counter, the counter 76 is capable of counting up to .a total of 127 pulses before it cycles back around to zero. By way of example, the AND circuit 77 is connected to the four highest order stages in the counter 76. As a consequence, AND circuit 77 will produce a one level output signal when the one hundred twentieth pulse is counted by the counter 76. Since these pulse generator pulses are occurring at the rate of 6 per minute, this means that the AND circuit 77 one level output signal will be produced 20 minutes after the counter 76 is first turned on by the activating signal on flipflop output line 66. Thus, in this example, the timer circuits 61 provide a time delay of 20 minutes. The particular value of time delay which is used can be changed by changing either the rate of generation of the pulses in the generator 75 or by changing the stages of the counter 76 to which the AND circuit 77 is connected. Preferably, this time delay is in the range of 10 to 30 minutes. 7

If a longer duration steady-type output signal, as opposed to a pulse-type output signal, is desired at the output terminals 79, this can be provided by inserting a flip-flop circuit between the output of the AND circuit 77 and the switch 78 such that this flip-flop circuit will be shifted to the one-level output condition upon the appearance of a one level at the output of AND circuit 77 The logic circuits of FIG. 3 further include a battery pack 80 for providing the operating voltage for the various circuits shown in FIG. 3. One side of the battery pack 80 is connected by way of an on-off switch 81 to a voltage supply terrninal82, the other side of the battery pack 80 being grounded. The voltage supply terminal 82 is connected by way of appropriate voltage supply lines (not shown) to each of the other circuits shown in FIG. 3. Also, though not shown for sake of simplicity, each of the other circuits in FIG. 3 includes a ground connection which connects back to the ground connection of the battery pack 80.

The FIG. 3 circuits further include a single-shot or monostable multivibrator circuit 83 having a manual firing switch 84 which, when closed, causes the single-shot circuit 83 to produce a preliminary setup pulse at its output terminal 85. This output terminal 85 is connected by way of appropriate conductors (not shown) to the P input terminals of the updown counter 48, the AND circuit 69 and the AND circuit 72. The single-shot circuit 83 is constructed so that the output terminal 85 is'at the binary one level except during the occurrence of the preliminary setup pulse, during which time it goes to the binary zero level.

Switches 78, 81 and 84 are mechanically linked with the control shaft 29 which, as indicated in FIG. 1, can be manipulated from outside of the control apparatus housing 17. The various electronic circuits shown in FIG. 3 are preferably of the integrated circuit type. As such, they require very little space inside of the control apparatus housing 17. Also, since circuits of this type are solid state type circuits, the current drain on the battery pack is a minimum.

OPERATION OF THE PREF EMBODIMENT Considering now the operation of the above described subsurface control apparatus, the switch control shaft 29 is initially set so that all of the switches 78, 81 and 84 are in their open positions. The control apparatus 10 is then connected to the downhole device which is to be operated, in this case, the packer device 11. The wire line 12 is connected to the control apparatus 10 and the apparatus is moved into position for lowering into the oil or gas well. At this point, the switch control shaft 29 is manipulated to closethe battery pack switch 81. This energizes the various circuits shown in FIG-3. The switch control shaft 29 is then again manipulated to close the preliminary setup switch 84. The resulting preliminary setup pulse P sets the up-down counter 48 to an initial binary 1 I11 condition. By means of the AND circuits 69 and 72, it also plac'es'the flip-flop circuits 63 and 65 in their reset conditions. Thereafter, the switch control shaft 29 is again manipulated to close the control apparatus output switch 78. This manipulation also opens the preliminary setup switch 84. The battery pack orwff switch 81 remains closed during these latter two manipulations. The control apparatus 10 is now ready to be lowered into the string of easing pipe 15 lining the wall of the oil or gas well.

For sake of an example, it will be assumed that it is desired to set the packer device 11 at a depth of some 2,000 feet or more in the oil or gas well. As the control apparatus 10 and packer device 11 are lowered to this depth, the up-down counter 48 commences to count the signals which are periodically produced by the collar locator 18 as it periodically passes one of the casing collars between successive pipe sections. The counter 48 counts the first 15 collar locator signals, whereupon the' counting action ceases and the counter 48 holds its then existent count condition, which is the 0000 condition. In other words, for these first l5 collars the counter 48 counts downward from its initial 1111 setting to the lower limit 0000 condition. At this point, the NAND circuit 62 output goes to the zero level, which disables the down gate AND circuit 58 and thus prevents further counting for the subsequent downward movement.

The downward movement of the control apparatus 10 and packer device 11 continues until the packer device 11 reaches the depth at which it is to be set or, at most, a depth not more than seven pipe sections below the desired setting depth. At this point, the movement of the control apparatus 10 and packer device 11 is halted. The depth of the packer device 11 is known from the amount of the wire line 12 which has been reeled out in lowering the packer device 11 into the well.

Afterv the downward movement of the control apparatus 10 and packer device 11 has been halted, the control apparatus 10 and packer device 11 are then moved in an upwardly direction past at least three but not more than seven casing collars. Immediately after the third casing collar is passed in this upward movement, the counter 76 in the timer circuits 61 is activated to commence the preset timing cycle (e.g., 20 minutes). The packer device 11 is then moved a short distance to its final resting position, namely, the desired packer setting depth. The packer device 11 is then held in this position and is thereafter set into place in the casing string 15 when the timer cigrcuits 61 produce the control signal at the output terminal 7 After the initial activation of the timing circuit counter 76 (passage of third casing collar when moving in upward direction), the position of the control apparatus 10 and packer device 11 can be thereafter adjusted in either an upwardly or downwardly direction so long as a net total of not more than three collars is passed in the downward direction or a net total of not more than four collars is passed in the upward direction. If either of these limits is exceeded, the flip-flop circuit 65 is reset and, hence, the timer counter 76 is also reset and maintained in a disabled condition. If thecasing collars are spaced 30 feet apart, this allows for a downward adjustment of 90 feet and an upward adjustment of 120 feet without disabling the timer circuits 61. 1

The ability to turn. off the timer circuits 61 and hence to prevent the operation of the downhole device represents a safety feature in case anything should go wrong and it should become necessary not to set the downhole device. Also, it means that the downhole device cannot be completely withdrawn from the oil well without causing an automatic disabling of the timer circuits '61.

In the event that the timer circuits 61 should be disabled and it should thereafter be desired to restart such timer circuits 61, then this can be accomplished by manipulating the movement of the control apparatus such that the up-do'wn counter 48 is returned to its lower limit 0000 condition and the control apparatus 10 thereafter moved in an upwardly direction a distance corresponding to a minimum of three casing collars.

As seen from' the foregoing, the electronic logic circuits of FIG. 3 are constructed so that the operation of the downhole device is not initiated until after a predetermined pattern of downward and upward movements of the control apparatus 10 has been caused to occur. The particular movement pattern which was described above is only one of many movement patterns which the logic circuits can be constructed to detect. Thus, the described movement pattern should be taken by way of example and not by way of limitation on the scope of the invention.

While there has been described what is at present considered to be a preferred embodiment of this invention, it will be obvious to those skilled in the art that various changes and modifications may be made therein without departing from the invention, and it is, therefore, intended to cover all such changes and modifications as fall within the true spirit and scope of the invention.

1 claim:

1. Subsurface control apparatus for use in an oil or gas well having a string of pipe therein comprising:

housing means adapted to be lowered through the string of pipe and including means for coupling thereto and lowering therewith a downhole device which requires operation after it is lowered into the well;

magnetic detector means located in the housing means for generating an electrical signal each time the detector means moves past a pipe joint; and

electronic logic counting circuit means located in the housing means and responsive to the signals produced by the magnetic detector means for counting said signals and producing a control signal for initiating the operation of the downhole device.

2. Subsurface control apparatus in accordance with claim 1 wherein the magnetic detector means includes:

permanent magnet means for producing magnetic flux;

pole piece means for enabling the magnetic flux to link with the well pipe; and

coil means responsive to changes in the magnetic flux for producing electrical signals indicative of such changes.

3. Subsurface control apparatus in accordance with claim 1 further including; a nonelectrical wire line connected to said housing means for supporting same in the pipe string; said wire line constituting the sole support means for said housing means and said means therewith.

4. Subsurface control apparatus in accordance with claim 1 wherein the magnetic detector means produces an electrical signal having a positive and a negative fluctuation each time the detector means moves past a pipe joint, the order of occurrence of the positive and negative fluctuations being dependent on the direction of movement of the detector means past Jilin. the pipe joint, and wherein the electronic logic circuit means includes:

bistable circuit means coupled to the magnetic detector means for changing states in response to the magnetic detector signals, the final state following any given magnetic detector signal depending on the order of occurrence of the positive and negative fluctuations;

pulse generator circuit means coupled to the bistable circuitmeans for generating a delayed pulse a predetermined time interval after each change of state of a particul polarity in such bistable circuit means; I an up-down pulse counter; circuit means .for coupling the bistable circuit means to the up down pulse counter for controlling the direction of counting therein; circuit means for coupling the output of the pulse generator circuit means to the pulse counting input of the up-down pulse counter;

timer circuit means for producing the control signal to be supplied to the downhole device a predetermined time in} terval after an activating signal is'supplied to such timer circuit means; and v logic circuit means coupled to the 'up-down pulse counter for detecting the occurrence of a predetermined number of downward counts and thereafter a predetermined number of upwardcounts for thereupon supplying an ac- 'tivating signal to the timer circuit means, such logic circuit means also including means for thereafter disabling the timer circuit means if more than predetermined numbers of net upward or downward counts occur after the activating signal is first supplied to the timer circuit means.

5. Subsurface control apparatus in accordance with claim 4 wherein the magnetic detector means includes:

permanent magnet means for producing magnetic flux;

pole piece means for enabling the magnetic flux to link with the well pipe; and

coil means responsive to changes in the magnetic flux for producing electrical signals indicative of suchc'hanges.

6. Subsurface control apparatus in accordance with claim I wherein the electronic logic circuit means includes:

counting circuit means for counting magnetic detector signals produced during downward and upward movements of the detector means; and circuit means coupled to the counting circuit means and responsive to the downward and upward counts of such counting circuit means for producing the control signal for the downhole device after the detection of a predetermined pattern of downward and upward counts.

7. Subsurface control apparatus in accordance with claim 6 wherein:

the signals produced by the magnetic detector means have a polarity characteristic which is dependent on the direction of movement of the detector means past the pipe joint; and

the counting circuit means includes up-down counter circuit means for counting in one direction in response to downward movement produced magnetic detector signals and for counting in the other direction in response to upward movement produced magnetic detector signals.

8. Subsurface control apparatus in accordance with claim 7 wherein the electronic logic circuit means further includes circuit means responsive to the magnetic detector signals for s'upplying pulses to the counting input of the up-down counter circuit 'means and for supplying direction control signals to the up-down counter circuit means for controlling'the direction of counting for the pulses.

9. Subsurface control apparatus in accordance with claim 6 wherein the circuit means coupled to the counting circuit means includes: 1

detector circuit means for producing an activating signal upon the detection of a predetermined pattern "b downward and upward counts; and

timer circuit means responsive to the activating signal for producing the control signal for the downhole device a 11. Subsurface control apparatus in accordance with claim 9 wherein the detector circuit means further includes means for disabling the timer circuit means if more than predetermined numbers of net upward or downward counts occur after the initial occurrence of the activating signal. 

2. Subsurface control apparatus in accordance with claim 1 wherein the magnetic detector means includes: permanent magnet means for producing magnetic flux; pole piece means for enabling the magnetic flux to link with the well pipe; and coil means responsive to changes in the magnetic flux for producing electrical signals indicative of such changes.
 3. Subsurface control apparatus in accordance with claim 1 further including; a nonelectrical wire line connected to said housing means for supporting same in the pipe string; said wire line constituting the sole support means for said housing means and said means therewith.
 4. Subsurface control apparatus in accordance with claim 1 wherein the magnetic detector means produces an electrical signal having a positive and a negative fluctuation each time the detector means moves past a pipe joint, the order of occurrence of the positive and negative fluctuations being dependent on the direction of movement of the detector means past the pipe joint, and wherein the electronic logic circuit means includes: bistable circuit means coupled to the magnetic detector means for changing states in response to the magnetic detector signals, the final state following any given magnetic detector signal depending on the order of occurrence of the positive and negative fluctuations; pulse generator circuit means coupled to the bistable circuit means for generating a delayed pulse a predetermined time interval after each change of state of a particular polarity in such bistable circuit means; an up-down pulse counter; circuit means for coupling the bistable circuit means to the up-down pulse counter for controlling the diRection of counting therein; circuit means for coupling the output of the pulse generator circuit means to the pulse counting input of the up-down pulse counter; timer circuit means for producing the control signal to be supplied to the downhole device a predetermined time interval after an activating signal is supplied to such timer circuit means; and logic circuit means coupled to the up-down pulse counter for detecting the occurrence of a predetermined number of downward counts and thereafter a predetermined number of upward counts for thereupon supplying an activating signal to the timer circuit means, such logic circuit means also including means for thereafter disabling the timer circuit means if more than predetermined numbers of net upward or downward counts occur after the activating signal is first supplied to the timer circuit means.
 5. Subsurface control apparatus in accordance with claim 4 wherein the magnetic detector means includes: permanent magnet means for producing magnetic flux; pole piece means for enabling the magnetic flux to link with the well pipe; and coil means responsive to changes in the magnetic flux for producing electrical signals indicative of such changes.
 6. Subsurface control apparatus in accordance with claim 1 wherein the electronic logic circuit means includes: counting circuit means for counting magnetic detector signals produced during downward and upward movements of the detector means; and circuit means coupled to the counting circuit means and responsive to the downward and upward counts of such counting circuit means for producing the control signal for the downhole device after the detection of a predetermined pattern of downward and upward counts.
 7. Subsurface control apparatus in accordance with claim 6 wherein: the signals produced by the magnetic detector means have a polarity characteristic which is dependent on the direction of movement of the detector means past the pipe joint; and the counting circuit means includes up-down counter circuit means for counting in one direction in response to downward movement produced magnetic detector signals and for counting in the other direction in response to upward movement produced magnetic detector signals.
 8. Subsurface control apparatus in accordance with claim 7 wherein the electronic logic circuit means further includes circuit means responsive to the magnetic detector signals for supplying pulses to the counting input of the up-down counter circuit means and for supplying direction control signals to the up-down counter circuit means for controlling the direction of counting for the pulses.
 9. Subsurface control apparatus in accordance with claim 6 wherein the circuit means coupled to the counting circuit means includes: detector circuit means for producing an activating signal upon the detection of a predetermined pattern of downward and upward counts; and timer circuit means responsive to the activating signal for producing the control signal for the downhole device a predetermined time interval after the initial occurrence of the activating signal.
 10. Subsurface control apparatus in accordance with claim 9 wherein the duration of the predetermined time interval of the timer circuit means is in the range of 10 to 30 minutes.
 11. Subsurface control apparatus in accordance with claim 9 wherein the detector circuit means further includes means for disabling the timer circuit means if more than predetermined numbers of net upward or downward counts occur after the initial occurrence of the activating signal. 